<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="time">

  </div>

  <script>
    const timeEl = document.querySelector('#time')

    const getTime = async() => {
      const response = await fetch('http://localhost:3001/getTime')

      const res = await response.text()

      console.log(res);

      timeEl.innerHTML = res

      // 拿到结果后，继续发送 - 长轮询
      getTime()
    }

    getTime()
  </script>
</body>
</html>